package aleetcode;

import java.util.Scanner;

public class _2 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        System.out.println("请输入一个整数：");
        int x = scanner.nextInt();
        Solution2 solution1 = new Solution2();
        boolean result = solution1.isPalindrome(x);
        if (result){
            System.out.println("是回文数");
        }else {
            System.out.println("不是回文数");
        }
    }

}
class Solution2 {
    public boolean isPalindrome(int x) {
        if(x<0)
            return false;
        String s= String.valueOf(x);
        StringBuilder sb=new StringBuilder(s);
        StringBuilder reverse = sb.reverse();
        if(s.equals(reverse.toString()))
            return true;
        return false;
    }
}